package com.cv.platform.controller.audit.video;

import com.cv.framework.common.pojo.PageResult;
import com.cv.framework.common.pojo.Result;
import com.cv.framework.role.core.annotations.RolePermit;
import com.cv.platform.controller.audit.video.vo.AuditVideoPageReqVO;
import com.cv.platform.controller.audit.video.vo.AuditVideoSaveReqVO;
import com.cv.platform.controller.platform.video.vo.CvVideoItemRespVO;
import com.cv.platform.controller.platform.video.vo.detail.CvVideoDetailRespVO;
import com.cv.platform.service.video.CvVideoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static com.cv.framework.common.pojo.Result.success;

/**
 * 客服审核平台 - 视频控制层
 *
 * @author Charles_XDXD
 */
@Tag(name = "客服审核平台 - 视频控制层")
@RestController
@RequestMapping("/platform/video")
public class AuditVideoController {

    @Resource
    private CvVideoService cvVideoService;

    @PutMapping("audit")
    @Operation(summary = "审核视频")
    public Result<Void> auditVideo(@RequestBody AuditVideoSaveReqVO reqVO) {
        cvVideoService.auditVideo(reqVO);
        return success();
    }

    @GetMapping("auditedVideoPage")
    @Operation(summary = "分页查询审核的视频")
    @RolePermit(values = "audit_admin")
    public Result<PageResult<CvVideoItemRespVO>> getAuditedVideoPage(AuditVideoPageReqVO reqVO) {
        return success(cvVideoService.getVideoAuditPage(reqVO));
    }
    
    @GetMapping("videoDetail")
    @Operation(summary = "获取视频详情")
    public Result<CvVideoDetailRespVO> getVideoDetail(Long videoId) {
        return success(cvVideoService.getVideoDetail(videoId, true));
    }

}
